<?php
import( 'de.ceus-media.framework.neon.View' );
/**
 *	Views of Authentification.
 *	@package		tools.BugTracker
 *	@extends		CMF_Krypton_View
 *	@author			Christian Würker <Christian.Wuerker@CeuS-Media.de>
 *	@since			01.11.2005
 *	@version		1.0
 */
/**
 *	Views of Authentification.
 *	@package		tools.BugTracker
 *	@extends		CMF_Krypton_View
 *	@author			Christian Würker <Christian.Wuerker@CeuS-Media.de>
 *	@since			01.11.2005
 *	@version		1.0
 *	@todo			Language Support of Messages
 *	@todo			Code Documentation
 */
class AuthViews extends CMF_Krypton_View
{
	public function buildContent()
	{
		$request		=& $this->ref->get( 'request' );
		$auth		=& $this->ref->get( 'auth' );
		
		$link			= $request->get( 'link' );
		if( !$auth->isAuthenticated() )
		{
			return $this->buildLogin();
		}
		return "";
	}

	public function buildControl()
	{
		return $this->loadContent( "login_control.wiki" );
	}
	

	/**
	 *	Contructs HTML Output.
	 *	@access		private
	 *	@return		string
	 */
	private function buildLogin()
	{
		$request		= $this->ref->get( 'request' );
		$words		= $this->words['auth']['login'];

		$input_username	= $this->html->Input( 'username',	$request->get( 'username' ), 'in' );
		$input_password	= $this->html->Password( 'password', 'in' );
		$button_login		= $this->html->Button( 'login', $words['button'] );

		$ui['label_username']	= $this->html->Label( 'username',	$words['username'] );
		$ui['label_password']	= $this->html->Label( 'password',	$words['password'] );

		$ui['field_username']	= $this->html->Field( 'username',	$input_username );
		$ui['field_password']	= $this->html->Field( 'password',	$input_password );
		$ui['field_button']		= $this->html->Field( '', $button_login );
		
		$ui['colgroup']		= $this->html->ColumnGroup( "30%", "70%" );
		$ui['caption']		= $this->html->TableCaption( $words['caption_login'] );
		$ui['form']		= $this->html->Form( 'login', "?link=".$request->get( 'link' ) );

		return $this->loadTemplate( "auth.login", $ui );
	}

}
?>
